41. Extracting Slope and Intercept

Extracting Slope and Intercept

Question:

Import LinearRegression from sklearn, and create/fit your regression. Name it reg so that the plotting code will show it overlaid on the scatterplot. Does it fall approximately where you expected it?

Extract the slope (stored in the reg.coef_ attribute) and the intercept. What are the slope and intercept?

Start Quiz:

INSTRUCTOR NOTE:

Note: If you are not getting the results expected by the grader, then you may want to check the file tools/feature_format.py . Due to changes in the final project, some file changes have affected the numbers output on this assignment as written. Check that you have the most recent version of the file from the repository, such that the featureFormat has a default parameter for sort_keys = False and that keys = dictionary.keys() results. There should also be a test_list variable that is used to filter missing data.